import datetime
from applications.extensions import db


class AccessLog(db.Model):
    __tablename__ = 'admin_accesslog'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='访问记录id')
    user_id = db.Column(db.Integer, comment='用户id')
    ip = db.Column(db.String(128), comment='访问ip')
    flowtotal = db.Column(db.String(128), comment='访问流量')
    city = db.Column(db.String(128), comment='访问城市')
    access_time = db.Column(db.DateTime, default=datetime.datetime.now, comment='访问时间')
    url = db.Column(db.String(256), comment='访问url')
    referer = db.Column(db.String(256), comment='访问来源')
    userAgent = db.Column(db.String(256), comment='访问设备')
    isp = db.Column(db.String(256), comment='运营商')
    position = db.Column(db.String(256), comment='位置')
